# Tracing and Logging

This section includes the following topics:

- Tracing
- Logging
- Other Options

## Tracing

Tracing is a facility to redirect any output in the JavaConsole to a trace file.

Tracing can be turned on by enabling the property `javaplugin.trace`. However, it turns on all tracing facilities inside Java Plug-in. To enable more fine-grained tracing,`javaplugin.trace.option` may be used. You can set trace-level options (0-5) in the Java Console, shown in the previous chapter, with the following meanings:

- 0 — off
- 1 — basic
- 2 — network and basic
- 3 — security, network and basic
- 4 — extension, security, network and basic
- 5 — LiveConnect, extension, security, network and basic

This enables tracing on the fly.

Another way to set fine-grained tracing is through the Java Plug-in Control Panel. For instance, to enable tracing for everthing (option 5 above), enter the following in the "Java Run Time Parameters" textfield:

> `-Djavaplugin.trace=true
> -Djavaplugin.trace.option=basic|net|security|ext|liveconnect`

Tracing set through the Control Panel will take effect when the Plug-in is launched, but changes made through the Control Panel while a Plug-in is running will have no effect until restart.

## Logging

Similar to tracing, logging is a facility to redirect any output in the Java Console to a log file using the Java Logging API. Logging can be turned on by enabling the property `javaplugin.logging`:

> `-D javaplugin.logging = true`

## Other Options

### File Names

By default the trace and log file names are, respectively:

> `.plugin<version>.trace` and `.plugin<version>.log`

However, you can give them different names by setting the properties:

> `javaplugin.trace.filename` and `javaplugin.log.filename`

in the Java Plug-in Control Panel.

### File Location

The default location (directory) of Java Plug-in related files is:

- `/usr/home` on Unix/Linux
- `\Winnt\Profiles\<user>` on Window

However, the location can be set with the environment variable `USER_JPI_PROFILE`.

### Overwrite Option

Furthermore, if you do not want to overwrite trace and log files each session, you can set the property `javaplugin.outputfiles.overwrite=false`. If the property is set `false`, then trace and log files will be uniquely named for each session. E.g., if default trace and log file names are used as shown above, then date information would be included as follows:

> `.plugin<username><date hash code>.trace` and `.plugin<username><date hash code>.log`